public class Learn4 {
    public static void main(String[] args) {
        double sum = 0;
        int flg = 1;              //实现 + - 的效果
        int n = 1;
        while (n <= 100){
            sum += 1.0/n * flg;
            flg = -flg;
            n++;
        }
        System.out.println(sum);
    }
}
